#include "mystack.h"

#define BINARY 		2
#define OCTONARY 	8
#define DECIMAL 	10
#define HEXADECIMAL 16


void test_convert(int src, int decimal)
{
	char num[] = "0123456789ABCDEF";
	MyStack<int> *mystack = new MyStack<int>(30);

	int N = src;
	int mod = 0;

	while(N != 0) {
	    mod = N % decimal;
	    mystack->push(mod);
	    N = N / decimal;
	}

	//mystack->stackTraverse(false);

	while(!mystack->stackEmpty()) {
	    int i = 0;
	    mystack->pop(i);
	    std::cout << num[i];
	}
	std::cout << ""<< std::endl;


	delete mystack;
	mystack = NULL;	
}



int main(int argc, char const *argv[])
{


	int N = 1348;
	N = 26;
	test_convert(N, BINARY);
	test_convert(N, OCTONARY);
	test_convert(N, DECIMAL);
	test_convert(N, HEXADECIMAL);





	return 0;
}